package com.spt.springbootzhsx.service;

import com.spt.springbootzhsx.dao.AdminDao;
import com.spt.springbootzhsx.entity.Admin;
import com.spt.springbootzhsx.entity.back.AdminBack;
import com.spt.springbootzhsx.mapper.AdminMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
@Service
public class AdminImpl implements AdminService{
    @Autowired
    private AdminMapper adminMapper;
    @Autowired
    private AdminDao adminDao;

    @Override
    public ArrayList<Admin> getAllAdmin() {
        return adminMapper.getAllAdmin();
    }

    @Override
    public ArrayList<AdminBack> getAdminAllInfoByAid(Integer aid) {
        return adminDao.getAdminAllInfoByAid(aid);
    }

    @Override
    public String updateAdminPwd(Integer aid, String password) {
        int k=adminMapper.updateAdminPwd(aid,password);
        if(k>=1){
            return "管理员密码更新成功！";
        }else{
            return "管理员密码更新失败！";
        }
    }
}
